package com.gitee.yanfanvip.interfaces;

import java.util.Set;
import java.util.function.BiConsumer;
import org.rocksdb.RocksDBException;

public interface DatabaseReader {

	/**
	 * 是否存在某个数据
	 * @param keyspaces keyspaces
	 * @param key key
	 * @return 是否存在
	 * @throws RocksDBException error
	 */
	public boolean containsKey(String keyspaces, String key)throws RocksDBException;
	/**
	 * 获取数据内容
	 * @param keyspaces keyspaces
	 * @param key key
	 * @return 值内容
	 * @throws RocksDBException error
	 */
	public byte[] get(String keyspaces, String key)throws RocksDBException;
	/**
	 * 循环某个keyspaces
	 * @param keyspaces keyspaces
	 * @param consumer consumer
	 * @throws RocksDBException error
	 */
	public void forEach(String keyspaces, BiConsumer<String, byte[]> consumer)throws RocksDBException;
	/**
	 * 获取所有Keyspaces
	 * @return keyspaces列表
	 * @throws RocksDBException
	 */
	public Set<String> keyspaces()throws RocksDBException;
}
